﻿<!doctype html>
<html>
<head>
    <title>商家注册</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta content="width=device-width,initial-scale=1,maximum-scale=1, user-scalable=no" name="viewport"/>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
 
    <link rel="shortcut icon" href="http://www.meituan.com/favicon.ico" type="image/x-icon" />
    <link rel="Bookmark" href="http://www.meituan.com/favicon.ico" type="image/x-icon" />
 
    <link href="http://cs0.meituan.net/mtfe_cos_mtcrm/css/crm-min.va8b8cfff.css" type="text/css" rel="stylesheet"/>
    
 
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>商家注册</title>
 
<script> 
// pageload加载参数初始化, 页面最开始是设置
M = window.M || {};
M.gaAccount = 'UA-28174807-1';
 
// http://performance.sankuai.com
 
(function(a,b){function d(){var a=document.createElement("script");a.async=!0,a.src="//s0.meituan.net/vendor/js/mta.min.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}if(a.MeituanAnalyticsObject=b,a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)},"complete"===document.readyState)d();else{var c=window.onload;window.onload=function(){d(),c&&c()}}})(window,"mta");
mta("create","53faf0df559e6a3a1a2e6b9b");
mta("send","page");
 
if (typeof YUI_config === 'undefined') {
    YUI_config = {};
}
YUI_config['mt-beacon'] = {
    domainHost: 'sankuai.com',
    cdnDomainHost: 'meituan.net',
    data: {}
};
YUI_config['mt-log'] = {
    pageview: {
        data: {
            st: (new Date()).getTime()
        }
    }
};
YUI_config['mt-log'].__reqStart = 1456900474518;
 
// 根据cookie记录折叠/展开sidebar
(function() {
    var cookieMatch = document.cookie.match(/cos-ui-sidebar=([^;]*)/),
        cookieStatus = cookieMatch && cookieMatch[1],
        html;
    if (cookieStatus) {
        html = document.documentElement;
        html.className += ' main-nav-' + cookieStatus;
    }
}());
</script>
 
<link href="http://cs0.meituan.net/mtfe_cos_mtcrm/node_modules/mtfe_cos-ui/cos-ui-min.ve82033f4.css" rel="stylesheet">
<script> 
if (typeof YUI_config === 'undefined') {
    YUI_config = {};
}
YUI_config.yuiVersion = '3.17.2';
YUI_config.baseUri = 'http://cs0.meituan.net/mtfe_cos_mtcrm/';
YUI_config.comboBase = 'http://jc.meituan.net/combo/?f=';
YUI_config.debug = false;
YUI_config.combine = true;
YUI_config.cosPackage = {
    name: 'mtfe_cos_mtcrm'
};
YUI_config.cosGroups = [
    {
        name: 'cos.core',
        prefix: 'cos-',
        path: 'node_modules/mtfe_cos-core/'
    },
    {
        name: 'fecore',
        prefix: [ 'mt-', 'w-', 'p-', 'e-', 'uix-' ],
        path: 'node_modules/mtfe_fe.core/'
    },
    {
        name: 'cos.ui',
        prefix: 'ui-',
        path: 'node_modules/mtfe_cos-ui/'
    },
    {
        name: 'track',
        prefix: 'track-',
        path: 'node_modules/mtfe_cos_track/'
    },
    {
        name: 'mtcrm',
        prefix: 'crm-',
        path: ''
    }
];
</script>
<script> 
YUI_config['track-raven'] = { dsn: 'http://a391b6196aec4c4590140b5ca39bde47@sentry7.meituan.com/95' };
</script>
<script src="http://cs0.meituan.net/mtfe_cos_mtcrm/node_modules/mtfe_cos_track/raven/raven-all-min.js"></script>
<script src="http://cs0.meituan.net/yui/3.17.2/build/yui/yui-min.js"></script>
<script src="http://cs0.meituan.net/mtfe_cos_mtcrm/yui-config-mtcrm-min.vb5837956.js"></script>
 
 
 
    
</head>
<body class="theme-cos">
<div class="right-all" style="min-width:10px">
    
<style> 
#J-show-pic,
#file-container {
    margin-left: 108px;
    margin-bottom: 20px;
}
#select-file button {
    background-color: #33a34e;
}
#J-show-pic img {
    width: 300px;
    height: 200px;
}
</style>
<div id="add-business-opportunity">
    <div class="hdw">
        <div class="hd">
            <h1>
                <a class="logo" href="http://zhaoshang.meituan.com">
                
                </a>
            </h1>
        </div>
    </div>
    <div class="infos clearfix">
        <div class="boform-info">
        <div class="mainbox">
            <div class="content">
            <div class="title-tip">请填写您的注册信息</div>
            <div class="navbar-container category clearfix">
                
            </div>
            <form id="feedback-form" class="common-form" method="post" action="/crmopen/business/opportunity/add">
                <input type="hidden" id="J-pic-key" name="licenseFileKey"/>
                <div class="field-group">
                    <label class="field-item" for="fullname"><em class="required">*</em>您的姓名</label>
                    <input name="name" autofocus autocomplete="off" data-tips="请填写您的姓名" tabindex="1" id="fullname"  class="f-text smiddle-text user-name"  placeholder="请输入汉字或英文" value=""/>
                </div>
                <div class="field-group">
                    <label class="field-item" for="number"><em class="required">*</em>您的手机</label>
                    <input name="mobile" data-tips="请填写您的手机" autocomplete="off" tabindex="2" id="number" class="f-text smiddle-text mobile"  value=""/>
                </div>
                <div class="field-group">
                    <label class="field-item" for="email">邮箱</label>
                    <input name="email" data-tips="请填写您的邮箱" autocomplete="off" tabindex="3" placeholder="xxx@xx.com" id="email" class="f-text smiddle-text email" value=""/>
                </div>
                <div class="field-group">
                    <label class="field-item" for="contacts">其他联系方式</label>
                    <input name="contact" id="contacts" class="f-text smiddle-text" autocomplete="off" tabindex="4" placeholder="例如QQ号" value=""/>
                </div>

 
                <div class="field-group">
                    <label class="field-item" for="category"><em class="required">*</em>商家类型</label>
                    <div class="relative">
                      <input type="text"
                      class="f-text smiddle-text cat-name"
                      id="category"
                      name="typeDesc"
                      autocomplete="off"
                      tabindex="12" placeholder="可搜索"/>
                        <span class="cat-hint">
                            *审核通过后，会安排专门负责此类型的业务员与您接洽
                        </span>
                    </div>
                    <input type="hidden" name="type" class="cat-id"/>
                   
                </div>
               
     
 <hr/>

                <div class="field-group">
                    <label class="field-item" for="feedback-bizname"><em class="required">*</em>门店名称</label>
                    <input type="text" maxlength="100" name="bizname" data-tips="请填写门店名称" id="feedback-bizname" tabindex="5" autocomplete="off" class="f-text smiddle-text branch-name" value=""/>
                    <div class="warn">
                        <span>*请填写您店面的门头名称，如果有多分店的可以写上分店名称</span>
                    </div>
                </div>
                <div class="field-group">
                    <label class="field-item" for="feedback-city"><em class="required">*</em>城市</label>
                    <span>
                        <input type="text" class="f-text short-text city-name" autocomplete="off" placeholder="请搜索" name="locationcityname" tabindex="6" id="feedback-city"/>
                        <input type="hidden" class="city-id" name="locationcity" />
                    </span>
                   
              <div>
                    <label class="field-item"><em class="required">*</em>区域</label>
                     
                     <input type="text" class="f-text short-text district-name" placeholder="请搜索" autocomplete="off" tabindex="6" name="locationdistrictname"/>
                      
                   
           </div>
                
                    <label class="field-item" for="feedback-detailAddress"><em class="required">*</em>详细地址</label>
                    <textarea name="detailAddress" maxlength="250" data-tips="请填写详细地址" tabindex="9" class="address" id="feedback-detailAddress" ></textarea>
                    <div class="warn">
                        *请尽量准确地填写您的地址信息
                    </div>
                
                
               
               
                    <label class="field-item" for="branch-phone"><em class="required">*</em>门店电话</label>
                    <input type="text" name="branchPhone" id="branch-phone" class="f-text smiddle-text" autocomplete="off" tabindex="10" placeholder="010-" value=""/>
 
                    <div class="warn">
                        *请填写门店预约或者前台电话。如果没有，可以填写一个消费者能联系的电话
                    </div>
                
                
 
                <div class="cookie-error-tip error-tip" style="display:none;">您的浏览器禁用了cookie，团购信息将无法提交，请启用cookie。</div>
 
                <noscript>
                    <div class="error-tip">您的浏览器禁用了javascript，团购信息将无法提交，请启用javascript。</div>
                </noscript>
                <div class="field-group">
                    <input type="hidden" name="source" value="0"/>
                    <input type="submit" value="提交" tabindex="15" class="btn submit-btn btn-primary" name="commit" id="yui_3_17_2_4_1456907874747_290"/>
                </div>
            </form>
            </div>
        </div>
        
        <div class="side-feedback">
            <div class="side-single">
                <a class="add-feedback">
                    <i class='fa fa-users'></i>&nbsp;
                    <span>点此提交您的宝贵意见</span>
                </a>
            </div>
        </div>
    </div>
</div>
    <div class="feedback-container" style="display:none;">
        <form name="feedbackForm" class="feedback-form" method="post" action="/crmopen/feedback/businessOpportunity">
            <div class="content">
                <div class="field-group">
                    <label class="field-item"><em class="required">*</em>反馈内容:</label>
                    <textarea class="f-text feedback-info" maxlength="300" name="content"></textarea>
                </div>
                <div class="field-group">
                    <label class="field-item"><em class="required">*</em>联系方式:</label>
                    <input type="text" name="contact" maxlength="40" class="f-text contact-info smiddle-text"/>
                </div>
                <div class="field-group">
                    <label class="field-item"><em class="required">*</em>验证码:</label>
                    <input name="authCode" id="auth-code" tabindex="14" class="f-text short-text" autocomplete="off" value=""/>
                    <span class="auth-img-container" ><img class="add-on-img" alt="验证码" src="/crmopen/jcaptcha"/></span>
                    <span>看不清?<a href="javascript:void(0);" class="change-auth-img">换一张</a></span>
                </div>
            </div>
            <div class="footer">
                <p class="error-tip" style="display:none;"></p>
                <input type="submit" class="btn btn-primary submit-btn" value="提交"/>
            </div>
        </form>
    </div>
    <div class="go-top-w" style="display:none;">
        <div class="new-index-triffle-w">
            <a href="javascript:void(0);" class="add-feedback new-index-triffle">提交反馈</a>
        </div>
        <a href="javascript:void(0);" hidefocus="true" class="go-top">
            <i class='fa fa-chevron-up'></i>
        </a>
    </div>
    <div class="ftw">
        <div class="ft">
            <div class="links">
                <a href="http://www.meituan.com">美团首页</a> |
                <a href="http://www.meituan.com/about" gaevent="footer/aboutMT">关于美团</a> |
                <a href="http://www.meituan.com/about/press" gaevent="footer/media">媒体报道</a> |
                <a href="http://e.meituan.com/help/service" gaevent="footer/cooperation">合作流程</a> |
                <a href="http://epassport.meituan.com" gaevent="footer/cooperation">商家后台</a> |
                <a href="http://e.meituan.com/help/faq" gaevent="footer/faq">常见问题</a>
            </div>
            <div class="copyright">© <span title="I:-; Q:0; S:0; C:2; F:0; T:57.72; H:e01">2013</span> meituan.com 京ICP证070791号
            </div>
        </div>
    </div>
</div>
    <script src="http://cs0.meituan.net/mtfe_cos_mtcrm/business-opportunity/create-v2819b533.js"></script>
<script> 
    YUI_config['crm-business-opportunity/create'] = {
        init: true
    };
    M.use('crm-business-opportunity/create');
</script>
<script> 
    function _sosoApiCallback() {
        M.use('crm-map', function(Y) {
            if (navigator.cookieEnabled == false) {
                Y.one('.cookie-error-tip').show();
            }
            Y.mt.crm.Map.businessOpportunity();
        });
    }
    M.use('crm-util', function(Y) {
        Y.mt.crm.util.loadQQMap();
    });
</script>
 
</div>
 
<script type="text/javascript"> 
 
 
// 浏览器检测升级提醒
M.addCondition("cos-browser-upgrade-tip", "cos.core", {
    "test": function(Y) {
        if (Y.UA.android ||
            Y.UA.iphone ||
            Y.UA.ios ||
            (Y.UA.chrome && parseInt(Y.UA.chrome, 10) > 20)
        ) {
            return false;
        } else {
            return true;
        }
    },
    "trigger": "cos-pageload"
});
YUI_config.groups['cos.core'].modules['cos-browser-upgrade-tip'].skinnable = true;
 
 
 
YUI().use('cos-pageload', function(Y) {
 
    try {
        // onload/domready时的处理, 如记录时间和关闭mask等操作
        Y.mt.cos.PageLoad.init();
 
    } catch(err) {
        Y.error('cos.Pageload.init 发生错误', err, 'cos-pageload');
        return;
    }
 
    Y.use('ui-main', function(Y) {
        // cos.ui初始化
        Y.mt.ui.Main.init();
    });
 
        Y.use("mt-base", "track-ua", function(Y) {
            // 控件初始化
            Y.mt.widget.init();
 
            Y.track.ua();
        });
 
});
</script>
 
<script> 
//site初始化
M.use("crm-base", function(Y){
    var currentUri = "/business/opportunity/embed/add";
    var sysVersion = '3.6.2j';
    var versionMessage = '';
 
    Y.mt.crm.base.init(currentUri, sysVersion, versionMessage);
});
</script>
 
<script src='/static/@crm/mttracker/index-a4983112.js'></script>
<script> 
(function() {
    var opts = {};
    opts.clientid = null;
    require('mttracker/index')(opts);
}());
</script>
<script> 
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function()
    { (i[r].q=i[r].q||[]).push(arguments)}
    ,i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-28174807-1', 'auto');
ga('send', 'pageview');
</script>
 <script>
/**
 *
 */
YUI.add('crm-business-opportunity/create', function(Y, NAME) {
    var ndForm = Y.one('#feedback-form'),
        $Business = Y.mt.BusinessArea,
        $CrmUtil = Y.mt.crm.util,
        $Trim = Y.Lang.trim,
        $Util = Y.mt.util,
        $Common = Y.mt.crm.businessopportunity.common;

    var win = Y.config.win;
    var qsParams = Y.QueryString.parse(location.search.slice(1));

    var cityDataList = null,
        districtDataList = null,
        districtAuto = null,
        bizAuto = null,
        bizDataList = null;

    var $Bo = Y.namespace('mt.crm.businessopportunity');

    function Create() {
        if (!(this instanceof Create)) {
            return new Create();
        }
        // 初始化城市
        this.initOpportunityCity(ndForm, 110);
        // 提交表单事件
        this.submitFormEvt(ndForm);
        // 初始化textarea的默认文本提示
        this.initTextAreaDefaultTip();

        // 意见反馈
        new Y.mt.crm.businessopportunity.FeedBack({
            ndTrigger: '.add-feedback',
            fbContainer: Y.one('.feedback-container')
        });
        // 回到顶部
        new Y.mt.crm.businessopportunity.GoTop({
            container: Y.one('.go-top-w'),
            refNode: Y.one('.boform-info')

        });
        
        /**
         * 提交表单事件
         * @method submitFormEvt
         */
        submitFormEvt: function(ndForm) {
            var ndSubmitBtn = ndForm.one('.submit-btn'),
                _this = this;

            ndForm.on('submit', function(e) {
                e.halt(true);
                if (_this.checkBusinessOpportunityForm(ndForm)) {
                    var tipLoading = $CrmUtil.tipLoading();
                    $CrmUtil.toggleDisabled(ndSubmitBtn);
                    Y.io(ndForm.get('action'), {
                        method: 'POST',
                        form: {
                            id: 'feedback-form'
                        },
                        on: {
                            success: function(id, o) {
                                tipLoading.close();
                                $CrmUtil.toggleDisabled(ndSubmitBtn);
                                var data = $Util.decodeJSON(o.responseText);
                                if (data && data.status === 200) {
                                    location.href="/crmopen/business/opportunity/embed/addSuccess?handleDay=3";
                                } else {
                                    if (data && data.status) {
                                        $Common.showErrorTip(ndForm, data);
                                    } else {
                                        $CrmUtil.tipFn('<p>服务器异常，提交失败，请稍候重试</p>', '300');
                                    }
                                }
                            },
                            failure: function() {
                                tipLoading.close();
                                $CrmUtil.toggleDisabled(ndSubmitBtn);
                                $CrmUtil.tipFn('<p>意外错误，请刷新后重试</p>', '300');
                            }
                        }
                    });
                }
            });
        },
        /**
         * 检查商机表单
         * @method checkBusinessOpportunityForm
         */
        checkBusinessOpportunityForm: function(ndForm) {
            /*jshint -W074 */
            var ndUserName  = ndForm.one('.user-name'),
                userName = $Trim(ndUserName.get('value')),
                ndMobile = ndForm.one('.mobile'),
                mobile = $Trim(ndMobile.get('value')),
                ndEmail = ndForm.one('.email'),
                email = $Trim(ndEmail.get('value')),
                ndBranchName = ndForm.one('.branch-name'),
                branchName = $Trim(ndBranchName.get('value')),
                ndCityName = ndForm.one('.city-name'),
                ndCityId = ndForm.one('.city-id'),
                cityId = $Trim(ndCityId.get('value')),
                ndDistrictName = ndForm.one('.district-name'),
                ndDistrictId = ndForm.one('.district-id'),
                districtId = $Trim(ndDistrictId.get('value')),
                ndBizAreaName = ndForm.one('.bizarea-name'),
                ndBizAreaId = ndForm.one('.bizarea-id'),
                bizAreaId = $Trim(ndBizAreaId.get('value')),
                ndAddress = ndForm.one('.address'),
                address = $Trim(ndAddress.get('value')),
                ndDailySales = ndForm.one('.daily-sales'),
                dailySales = $Trim(ndDailySales.get('value')),
                ndCategory = ndForm.one('.cat-id'),
                ndPhone = ndForm.one('#branch-phone'),
                phone = $Trim(ndPhone.get('value')),
                ndCategoryName = ndForm.one('.cat-name'),
                category = $Trim(ndCategory.get('value')),
                ndLicense = ndForm.one('input[name=hasLicense]:checked'),
                ndLicenseKey = ndForm.one('#J-pic-key'),
                ndLongitudeVo = ndForm.one('input[name=longitudeVo]'),
                ndLatitudeVo = ndForm.one('input[name=latitudeVo]');

            /*jshint maxcomplexity:21 */ 
            // 姓名
            var nameReg = new RegExp(/^([\u4e00-\u9fa5]|[a-zA-Z]|[0-9])+$/);
            if (userName === '') {
                win.alert('请填写您的姓名');
                ndUserName.focus();
                return false;
            } else if (!nameReg.test(userName)) {
                win.alert('姓名只支持中英文和数字');
                ndUserName.focus();
                return false;
            } else if (userName.length > 30) {
                win.alert('姓名长度过长，请不要超过30个字符');
                ndUserName.focus();
                return false;
            }

            // 手机号
            var mobileReg = new RegExp(/^\d+$/);
            if (mobile === '') {
                win.alert('请填写手机号');
                ndMobile.focus();
                return false;
            } else if (mobile.length !== 11 || !mobileReg.test(mobile)) {
                win.alert('填写的手机号格式不对');
                ndMobile.focus();
                return false;
            }

            // 邮箱
            /* jshint maxlen:1000 */
            var emailReg = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
            if (email.length > 0  && !emailReg.test(email)) {
                win.alert('填写的邮箱格式不正确, 例如:xxxx@meituan.com');
                ndEmail.focus();
                return false;
            }

            // 团购类型
            if (category === '') {
                win.alert('团购类型不允许为空');
                ndCategoryName.focus();
                return false;
            } else if (category === '-1') {
                win.alert('请选择二级类型');
                ndCategoryName.focus();
                return false;
            }


            // 商户名
            if (branchName === '') {
                win.alert('请填写门店名称');
                ndBranchName.focus();
                return false;
            } else if (/[\|｜、:：;；]/.test(branchName)) {
                win.alert("门店名称中不能包含特殊字符\\|｜、:：;；");
                ndBranchName.focus();
                return false;
            } else if (branchName.length > 100) {
                win.alert('门店名称长度过长，请不要超过100个字符');
                ndBranchName.focus();
                return false;
            }

            // 门店电话
            if (phone === '') {
                win.alert('请填写门店电话');
                ndPhone.focus();
                return false;
            }

            // 城市
            if (cityId === '') {
                win.alert('请填写城市,支持拼音搜索');
                ndCityName.focus();
                return false;
            }

            // 行政区
            if (districtId === '') {
                win.alert('请填写行政区,支持拼音搜索');
                ndDistrictName.focus();
                return false;
            }

            // 详细地址
            if (address === '') {
                win.alert('请填写详细地址');
                ndAddress.focus();
                return false;
            } else if (address.length > 250) {
                win.alert('详细地址长度过长，请不要超过250个字符');
                ndAddress.focus();
                return false;
            }

            // 日销售额
            var dailySalesReg = new RegExp(/^\d+$/);
            if (dailySales.length > 0 && !dailySalesReg.test(dailySales)) {
                win.alert('日销售额只支持数字');
                ndDailySales.focus();
                return false;
            }

            // 地图坐标
             if (!ndLatitudeVo.get('value') || !ndLongitudeVo.get('value')) {
              win.alert('请在地图上标注');
              return false;
            }

            return true;
        },
        /**
         * 初始化文本框默认提示信息
         * @method initTextAreaDefaultTip
         */
        initTextAreaDefaultTip: function() {
            var tip = "商家介绍:例如营业面积、本店特色等\n\n合作店数:\n\n套餐/产品:\n\n人均消费:\n\n日均可接待量:\n\n其他介绍:";
            Y.one('#suggest').set('value', tip);
        },
        /**
         * 初始化城市
         * @Method initOpportunityCity
         */
        initOpportunityCity: function(ndForm, width) {
            var ndCityId = ndForm.one('.city-id'),
                ndCityName = ndForm.one('.city-name'),
                _this = this;
            Y.mt.City.init(function(data) {
                //TODO 暂时将义乌从城市中去掉
                $Common.deleteYiWuCity(data);

                var idMap = Y.Array.reduce(data, {}, function(prev, item) {
                  prev[item.id] = item;
                  return prev;
                });

                var filterCity = new Y.mt.widget.AutoCompleteList({
                    node: ndCityName,
                    listParam: "name",
                    objList: data,
                    showMax: '10',
                    width: width,
                    callback: function() {
                        var cityId = ndCityId.get('value');
                        if (cityId !== '' && cityId !== '-1') {
                            _this.initDistrict(cityId, ndForm, width);
                        }
                    }
                });
                var selectedCity =  idMap[qsParams.locationcity];
                if (selectedCity) {
                  filterCity.once('render', function() {
                    filterCity.fillTargetInput(selectedCity);
                    _this.initDistrict(selectedCity.id, ndForm, width);
                  });
                }
                ndCityName.on('blur', function() {
                    if (cityDataList) {
                        var cityName = $Trim(ndCityName.get('value'));
                        Y.Array.some(cityDataList, function(item) {
                            if (cityName !== '' && item.name.indexOf(cityName) !== -1) {
                                ndCityId.set('value', item.id);
                                _this.initDistrict(item.id, ndForm, width);
                                return true;
                            }
                            return false;
                        });
                    }
                });
                filterCity.on('beforeShowResultBox', function(data) {
                    cityDataList = data.objList;
                });
            });
        },
        /**
         * 初始化行政区
         * @method initDistrict
         * @method {Number} cityId 城市id
         */
        initDistrict: function(cityId, ndForm, width) {
            var ndDistrictName = ndForm.one('.district-name'),
                ndDistrictId = ndForm.one('.district-id'),
                _this = this;

            $Business._initData(cityId, function(data) {
                if (districtAuto) {
                    districtAuto.updateData({data:data});
                    return;
                }
                districtAuto = new Y.mt.widget.AutoCompleteList({
                  objList: data,
                  listParam: "name",
                  node: ndDistrictName,
                  showMax: "10",
                  width: width || 90,
                  callback: function(data) {
                    _this.initBusinessArea(cityId, data.id || '', ndForm, width);
                  }
                });
                var idMap = Y.Array.reduce(data, {}, function(prev, item) {
                  prev[item.id] = item;
                  return prev;
                });
                var selectedDistrict = idMap[qsParams.geotagdistrict];
                if (selectedDistrict) {
                  districtAuto.fillTargetInput(selectedDistrict);
                  _this.initBusinessArea(cityId, selectedDistrict.id, ndForm, width);
                }
                ndDistrictName.on('blur', function() {
                  var districtName = $Trim(ndDistrictName.get('value'));
                  if (districtDataList) {
                    Y.Array.some(districtDataList, function(item) {
                      if (districtName !== '' && item.name.indexOf(districtName) !== -1) {
                        ndDistrictId.set('value', item.id);
                        _this.initBusinessArea(cityId, item.id || '', ndForm, width);
                        return true;
                      }
                      return false;
                    });
                  }
                });
                districtAuto.on('beforeShowResultBox', function(data) {
                  districtDataList = data.objList;
                });
            });
        },
        /**
         * 初始化商圈
         * @method initBusinessArea
         */
        initBusinessArea: function(cityId, locationId, ndForm, width) {
            var $Business = Y.mt.BusinessArea,
                ndBiz = ndForm.one('.bizarea-name'),
                ndBizId = ndForm.one('.bizarea-id');
            if (ndBiz) {
                $Business.getBusinessArea(locationId, function (data) {
                    if (!bizAuto) {
                        bizAuto = new Y.mt.widget.AutoCompleteList({
                            objList: data,
                            listParam: "name",
                            node: ndBiz,
                            showMax: "10",
                            width: width || 100
                        });
                        ndBiz.on('blur', function() {
                            var bizName = ndBiz.get('value');
                            if (bizDataList) {
                                Y.Array.some(bizDataList, function(item) {
                                    if (item.name.indexOf(bizName) !== -1) {
                                        ndBizId.set('value', item.id);
                                        return true;
                                    }
                                    return false;
                                });
                            }
                        });
                        bizAuto.on('beforeShowResultBox', function(data) {
                            bizDataList = data.objList;
                        });
                    } else {
                        bizAuto.updateData({data: data});
                    }
                }, {unproper: true});
            }
        }
    };

    $Bo.Create = Create;

    var gConf = Y.config[NAME];
    if (gConf.init === true) {
        new $Bo.Create(gConf);
    }

}, '1.0.0', {
    requires: [
        "crm-city",
        "crm-businessarea",
        "node",
        "io",
        "json",
        "uploader",
        "mt-base",
        "w-autocomplete",
        "w-base",
        "crm-business-opportunity/feedback",
        "crm-business-opportunity/common",
        "crm-business-opportunity/gotop",
        "crm-util",
        'querystring',
        'array-extras',
        "selector-css3"
    ]
});
</script>
</body>
</html>

